package fr.mk25.papervision3d.cameras{

    import org.papervision3d.cameras.FreeCamera3D;
    import fr.mk25.papervision3d.core.Position3D;
    import caurina.transitions.Tweener;
    import fr.mk25.papervision3d.util.BezierTween;

    public class AdvancedFreeCamera3D extends FreeCamera3D{

    
        public function AdvancedFreeCamera3D(initialPosition:Position3D=null){
            super();

            if(initialPosition!=null){
                this.x = initialPosition.x;
                this.y = initialPosition.y;
                this.z = initialPosition.z;
                this.rotationX = initialPosition.rotationX;
                this.rotationY = initialPosition.rotationY;
                this.rotationZ = initialPosition.rotationZ;
            }

        }


        public function getPosition3D():Position3D{
            return new Position3D(this.x, this.y, this.z, this.rotationX, this.rotationY, this.rotationZ);
        }


        public function setPosition3D(position:Position3D):void{
            this.x = position.x;
            this.y = position.y;
            this.z = position.z;
            this.rotationX = position.rotationX;
            this.rotationY = position.rotationY;
            this.rotationZ = position.rotationZ;
            
        }        


        public function move(   end_position:Position3D, 
                                start_position:Position3D=null, 
                                bezierArray:Array=null, 
                                duration:Number=10, 
                                transition_type:String="linear"
                              ):void{
            BezierTween.move(this,
                        end_position, 
                        start_position, 
                        bezierArray, 
                        duration, 
                        transition_type
                       );
        }


    } 


}
